# -*- coding: utf-8 -*-
from demo.common.logging.logging_config import setup_logging
import logging
from fastapi import FastAPI

app = FastAPI()
# 这里的 process thread threadName 都不需要自己设置，logging 模块会自动添加
log_format = "%(asctime)s - %(levelname)s - Process ID: %(process)d, Thread ID: %(thread)d, Thread Name: %(threadName)s - %(message)s"

setup_logging()
logger = logging.getLogger(__name__)

# logging.basicConfig(
#   level=logging.INFO,
#   format=log_format,
#   handlers=[
#       logging.FileHandler("/tmp/fast-demo.log"),
#       logging.StreamHandler()
#   ]
# )

@app.get("/")
async def read_root():
    logger.info("read_root go ==============")
    
    return {"Hello": "World"}

